<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.sql.*,java.util.*,com.bean.*,com.utils.*"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
	function checkupload() {
		var file = document.getElementById("file").value;
		if (file == null || file == "")
			return false;
		else
			return true;
	}
</script>
</head>
<body>
<!-- 获取该考试的信息 -->
	<%
		String examname = null;
		try {
			examname = request.getParameter("examname");
		} catch (Exception e) {
			System.out.println("Encoding");
		}

		if (examname == null){
			examname = (String) session.getAttribute("examname");
		}
		session.setAttribute("examname", examname);
		String exam_starttime = "";
		String upload = "";
		boolean autostart = false;
		Exam exam = DaoFactory.getExamDaoInstance().singleexamsearch(examname);
		exam_starttime = exam.getE_starttime();
		autostart = exam.getE_autostart();
		upload = exam.getE_examination();
	%>

<jsp:include page="teacher_head.jsp"></jsp:include>
<div class="container">
		<br />
		<div class="col-md-offset-1 col-md-10">
			<div class="panel panel-info">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-th-list"></span>编辑考试信息
					</h3>
				</div>
				<div class="panel-body">
					<form class="form-inline" role="form" action="../EditExam">
						<div class="form-group">
							<input type="text" class="form-control" value="<%=examname%>" placeholder="考试名称*" name="examname">
						</div>
						<div class="form-group">
							<div class="input-group date form_datetime"
								data-link-field="dtp_input2">
								<input name="exam_starttime" placeholder="考试时间*" class="form-control" type="text"> 
									<span class="input-group-addon"> 
										<span class="glyphicon glyphicon-remove"></span>
									</span> 
									<span class="input-group-addon"> 
										<span class="glyphicon glyphicon-calendar"></span>
									</span>
							</div>
						</div>
						<br />
						<div class="checkbox">
							<label style="font-size: 15px"> 
								<input name="exam_autostart" type="checkbox"
								<%if (autostart)
								out.print("checked='checked'");%>>
								自动开始
							</label>
						</div>
						<br />
						<button type="submit" class="btn btn-info">修改</button>
					</form>


				</div>
			</div>
		</div>


		<div class="col-md-offset-1 col-md-10">
			<div class="panel panel-info">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-th-list"></span>上传试卷
					</h3>
				</div>
				<div class="panel-body">
					<div class="navbar navbar-inverse"
						style="line-height: 50px;padding-left: 25px;color: white;margin-top: 8px;
						display: <%if (upload == null || upload.equals("null"))
							out.print("none");%>">
						已经上传过试卷，再次上传后原试卷将不可访问
						<a class="btn btn-default" href="../ExamDownload" style="margin-left: 10px">
							<span class="glyphicon glyphicon-eye-open"></span>下载查看
						</a>
					</div>
					<form class="form-inline" role="form" action="../ExamUpload" enctype="multipart/form-data" method="post">
						<input type="file" id="file" name="file" />
						<button type="submit" onclick="return checkupload()" style="margin-top: 5px" class="btn btn-info">上传</button>
					</form>
				</div>
			</div>
		</div>


		<div class="col-md-offset-1 col-md-10">
			<div class="panel panel-info">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-th-list"></span>导入学生名单
					</h3>
				</div>
				<div class="panel-body">
					<form>
						<label style="font-size: 12px">目前设定参加此次考试的学生人数：</label> <span>50</span>
						<br /> 
						<a href="../FenYe?exam=<%=examname%>" class="btn btn-info">继续导入</a>
					</form>
				</div>
			</div>
		</div>

		<div class="col-md-offset-1 col-md-10">
			<div class="panel panel-info">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-th-list"></span>开启考试
					</h3>
				</div>
				<div class="panel-body">
					<form action="../ExamStart">
						<span style="font-size: 12px;">尚未开启考试</span> <br />
						<button type="submit" style="margin-top: 12px"
							class="btn btn-warning">
							<span class="glyphicon glyphicon-off"></span>开启
						</button>
					</form>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript" src="../bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript">
		$.fn.datetimepicker.dates['zh-CN'] = {
			days : [ "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" ],
			daysShort : [ "周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日" ],
			daysMin : [ "日", "一", "二", "三", "四", "五", "六", "日" ],
			months : [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月",
					"十月", "十一月", "十二月" ],
			monthsShort : [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月",
					"9月", "10月", "11月", "12月" ],
			today : "今天",
			suffix : [],
			meridiem : [ "上午", "下午" ]
		};

		$(".form_datetime").datetimepicker({
			format : 'yyyy-mm-dd hh:ii:ss',
			language : 'zh-CN',
			autoclose : true,
			todayBtn : true,
			startDate : "2016-06-08 17:00",
			minuteStep : 1
		});
</script>
</body>
</html>